package org.opens.mybatisplus.dao.one2one;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import org.opens.mybatisplus.pojo.one2one.EkPerson;

@Mapper
public interface EkPersonDao {

    @Select(value = "select id, name, pet_id from ek_person where id = #{id}")
    @Results({
            @Result(id=true, column = "id", property = "id"),
            @Result(column = "name", property = "name"),
            @Result(column = "pet_id", property = "ekPet", one = @One(
                    select = "org.opens.mybatisplus.dao.one2one.EkPetDao.findById", fetchType = FetchType.LAZY
                    )
            )
    })
    public EkPerson findById(@Param("id") int id);


    public EkPerson findByIdUserXml(@Param("id") int id);

}
